﻿using Firestarter.DB.Schema.BO;
using FireStarterModeller.Test;
using Habanero.Testability;

namespace Firestarter.DB.Schema.Test.BO.TestUtils
{
    

    public class TestUtilsDBDatabase
    {
        public static BOTestFactory<DBDatabase> GetTestFactory()
        {
            return BOTestFactoryRegistry.Instance.Resolve<DBDatabase>();
        }
        /// <summary>
        /// Creates a new saved DBDatabase with a random value assigned to every property
        /// </summary>
        public static DBDatabase CreateSavedDBDatabase()
        {
            DBDatabase dBDatabase = CreateUnsavedValidDBDatabase();
            dBDatabase.Save();
            return dBDatabase;
        }

        /// <summary>
        /// Creates a new unsaved DBDatabase with a random value assigned to every property
        /// </summary>
        public static DBDatabase CreateUnsavedValidDBDatabase()
        {
            DBDatabase dBDatabase = new DBDatabase();
            dBDatabase.DatabaseName = TestUtilsShared.GetRandomString(1, 255);
            dBDatabase.Catalog = TestUtilsShared.GetRandomString();
            dBDatabase.Schema = TestUtilsShared.GetRandomString();
            //			dBDatabase.PendingChangeType = null;
            dBDatabase.Approved = TestUtilsShared.GetRandomBoolean();
            return dBDatabase;
        }

        /// <summary>
        /// Creates a new unsaved DBDatabase where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DBDatabase CreateUnsavedDefaultDBDatabase()
        {
            DBDatabase dBDatabase = new DBDatabase();
            return dBDatabase;
        }
    }
}